package com.sk.bilibili.model.fragment.main.home.home;

import com.sk.api.annotations.Autowired;
import com.sk.bilibili.mapper.VideoSetMapper;
import com.sk.bilibili.model.BaseRefreshModel;
import com.sk.bilibili.utils.RequestUtils;
import com.sk.bilibili.view.fragment.main.home.home.RecommendFragment;

public class RecommendModel extends BaseRefreshModel<RecommendFragment> {

    @Autowired
    VideoSetMapper videoSetMapper;
    private int page=1;
    private int size=10;

    @Override
    public void loadData() {
        RequestUtils.process(videoSetMapper.page(page, size,null), videoSetPage -> {
            view.loadSuccess(videoSetPage.getRecords());
            page++;
        });
    }

    @Override
    public void refreshData() {
        page=1;
        RequestUtils.process(videoSetMapper.page(page, size,null), videoSetPage -> {
            view.refreshSuccess(videoSetPage.getRecords());
            page++;
        });
    }

}